<?php

/**
 * This is the model class for table "{{object_qvfilters}}".
 *
 * The followings are the available columns in table '{{object_qvfilters}}':
 * @property integer $objfil_id
 * @property integer $objectlink_id
 * @property integer $qvf_id
 * @property string $filter
 *
 * The followings are the available model relations:
 * @property Objectlink $objectlink
 * @property Qvfields $qvf
 */
class ObjectQvfilters extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return ObjectQvfilters the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{object_qvfilters}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('objectlink_id, qvf_id', 'numerical', 'integerOnly'=>true),
			array('filter', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('objfil_id, objectlink_id, qvf_id, filter', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'objectlink' => array(self::BELONGS_TO, 'Objectlink', 'objectlink_id'),
			'qvf' => array(self::BELONGS_TO, 'Qvfields', 'qvf_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'objfil_id' => 'Objfil',
			'objectlink_id' => 'Objectlink',
			'qvf_id' => 'Qvf',
			'filter' => 'Filter',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('objfil_id',$this->objfil_id);
                $criteria->compare('objectlink_id',$this->objectlink_id);
		$criteria->compare('qvf_id',$this->qvf_id);
		$criteria->compare('filter',$this->filter,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}